#include <iostream>

using namespace std;

#define lc p << 1
#define rc p << 1 | 1
using ll = long long;

const int num = 5e5 + 10;

struct node
{
    int l, r;
    ll sum, add;
}tr[num << 2];
int n, m;
ll a[num];
void pushUp(int p) { tr[p].sum = tr[lc].sum + tr[rc].sum;}

void bulid (int p, int l, int r)
{
    tr[p] = {l, r, a[l], 0};
    if (r == l) return ;
    int mid = (l + r) >> 1;
    bulid(lc, l, mid);
    bulid(rc, mid + 1, r);
    pushUp(p);
}
void lazy(int p, ll k)
{
    tr[p].sum += (tr[p].r - tr[p].l + 1) * k;
    tr[p].add += k;
} 

void pushDown(int p)
{
    lazy(lc, tr[p].add);
    lazy(rc, tr[p].add);
    tr[p].add = 0;

}
void modify(int p, int x, int y, ll k)
{
    int l = tr[p].l, r = tr[p].r;
    // 是否是一个子区间
    if (x <= l && r <= y)
    {
        lazy(p, k);
        return ;
    }

    pushDown(p);
    int mid{(l + r) >> 1};
    if (x <= mid) modify(lc, x, y, k);
    if (y > mid) modify(rc, x, y, k);

    pushUp(p);

}
ll query(int p, int x)
{
    int l = tr[p].l, r = tr[p].r;
    if (l == x && r == x) return tr[p].sum;

    pushDown(p);
    int mid{(l + r) >> 1};
    ll sum = 0;
    if (x <= mid) sum += query(lc, x);
    else sum += query(rc, x);

    return  sum;
}
int main()
{
    cin >> n >> m;
    for (int i = 1; i <= n; i++) cin >> a[i];
    bulid(1, 1, n);
    while (m--)
    {
        int op, x, y;
        ll k;
        cin >> op >> x;
        if (op == 1)
        {
            cin >> y >> k;
            modify(1, x, y, k);
        }
        else cout << query(1, x) << endl;
    }
    return 0;
}